import axios from 'axios'

const api = {
  getShopList: '/idle/getShopList',
}

// 所有商品 - 列表
export const goodsList = (parameter: Record<any, any>) => {
  const { userName, Authorization, currentPage, pageSize, ...params } = parameter
  params.page_no = currentPage
  params.page_size = pageSize
  return axios({
    baseURL: 'https://api.goofish.pro/api/seller/product/list',
    method: 'get',
    headers: {
      Authorization: parameter.Authorization,
    },
    params,
  })
}

// 向x管家获取店铺列表
export const getShopList = (parameter: Record<any, any>) => {
  return axios({
    baseURL: 'https://api.goofish.pro/api/seller/shop/list',
    method: 'get',
    headers: {
      Authorization: parameter.Authorization,
    },
  })
}

// 售后待恢复商品 - 列表
export const salwWaitReplyGoodsList = (parameter: Record<any, any>) => {
  const { userName, Authorization, currentPage, pageSize, ...params } = parameter
  params.page_no = currentPage
  params.page_size = pageSize
  return axios({
    baseURL: 'https://api.goofish.pro/api/seller/product/restore/list',
    method: 'get',
    headers: {
      Authorization: parameter.Authorization,
    },
    params,
  })
}

// 恢复商品
export const stock = (parameter: { goods_id: number; Authorization: string }) => {
  return axios({
    baseURL: 'https://api.goofish.pro/api/seller/product/recover/stock',
    method: 'post',
    headers: {
      Authorization: parameter.Authorization,
    },
    data: { goods_id: parameter.goods_id },
  })
}

// 下架商品
export const pullOff = (parameter: { items: object; Authorization: string }) => {
  return axios({
    baseURL: 'https://api.goofish.pro/api/seller/product/pullOff',
    method: 'post',
    headers: {
      Authorization: parameter.Authorization,
    },
    data: { items: parameter.items },
  })
}
